In file structures such as sequential tape or sequential disk, data rows are added into a data block until it is full, then the next data block is accessed and so on. A data block is considered “full” when data rows no longer will fit in the data block, is considered “partially full” when at least one data row will fit in the data block, and is considered “empty” when there are no data rows in the data block. As such, an estimated percentage of fullness of a data area is computed as (“full data blocks”+“partial data blocks”)/“total data blocks”. Because data rows are sequentially filled in such file structures, there should be only one partial block at any given time. The estimated percentage is therefore a close approximation of actual fullness or capacity.
However, various operations on databases may decrease the accuracy of the estimated percentage of fullness. For example, relational database management systems provide various data space reuse options that allow data rows to be deleted from data blocks so that the space created from the deleted rows may be reused at a later time. In these cases, there may be a number of partial blocks instead of only one. As such, the above formula provides the percentage of data blocks in use (i.e., data blocks with at least one data row in them) and not the overall fullness of the data area (i.e., the physical area containing one or more data blocks for a database table or groups of tables), thereby decreasing the accuracy of the estimated percentage.
In addition, relational database management systems may support various data row compression methods. These methods compress data rows before storing them in fixed length data blocks. The amount and size of data rows that are stored on a data block can widely vary. When adding this complexity in with the various reuse options, the formula described above becomes an increasingly less accurate calculation to determine fullness of the data area.
Furthermore, data rows may have been deleted but the deletions may not have been committed. For these data rows, the space in the data block is “reserved” until the transaction is completed. These data rows are considered logically deleted but physically present.
Thus, what is needed is an efficient and reliable way to determine how full a data area is and to determine an available space in a data area.
These and other drawbacks exist.